import 'package:dio/dio.dart';
import 'package:flutter/material.dart';

class MyApp21 extends StatefulWidget {
  const MyApp21({super.key});

  @override
  State<MyApp21> createState() => _MyApp21State();
}

class _MyApp21State extends State<MyApp21> {
  @override
  void initState() {
    super.initState();
    getDate();
  }

  void getDate() async {
    // 1. 准备请求地址
    String path = 'https://mock.boxuegu.com/mock/1172/orders';

    // 2. 创建http client
    Dio dio = Dio();

    // 3. 发送网络请求，得到响应
    Response response = await dio.get(path);
    // 4. 提取订单列表数据
    print(response.data);
  }

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}
